<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>上传个好评评语，宝贝很好，我省款及受到了，我很快就收到了残品。宝贝保障的很好，很精致三色横
<div class="report_img">
    <span class="tit_em">上传好评截图：</span>
    <form method="post" action="/?m=user&do=upload_pic" onsubmit="return checkUploadPic($(this));" target="upload_action_pic" enctype="multipart/form-data" style="float: left;">
        <input name="target_url" id="report_imgurl" value="<?=$r_report_imgurl?>" type="hidden" />
        <input type="hidden" name="report" value="<?=$bs_id?>" />
        <input name="picurl" class="input chose_url" type="file" onchange="$(this).next().val($(this).val());">
        <a class="new_btn" onclick="$(this).next().click();" target="_self" href="javascript:;">上传图片</a>
        <input type="submit" class="hide_btn" value="提交">
    </form>
    <iframe name="upload_action_pic" id="upload_action_pic" style="display:none;height: 0px;overflow: hidden;width: 0px;" height="0" width="0"></iframe>
    <a class="new_btn new_btn-info" href="javascript:;" onclick="submitEidt();" target="_self" style="margin-left: 50px;">
        提交报告 </a>

</div>
<div style="margin-top: 5px;">

    <img id="view_report_img" src="<?=FUNC::titu($r_report_imgurl)."?s=".rand(12456,99999)?>" onload="if(this.width>200) this.width=200" alt="好评截图" />
</div>
</div>


<script type="text/javascript">
    $('#writecontent').xheditor();
    var r_waiguan= '<?=$r_waiguan?>';
    var r_gongneng= '<?=$r_gongneng?>';
    var r_shiyong= '<?=$r_shiyong?>';



    function submitEidt() {

        messageConfirm('确认提交','您确定要提交试用报告吗？','',function(this_moveid){

            var report_imgurl = form.find("#report_imgurl").val();

            //var writecontent =  $.trim(form.find('.writecontent').val());



            if(report_imgurl==''){
                hideNewBox();
                msg('请上传好评图片', 4);
                return false;
            }

            var newdata = {
                bs_id:bs_id,
                zuogong:zuogong,
                gneng:gneng,
                shiyong:shiyong,
                report_imgurl:report_imgurl

            };
            hideNewBox();
            msg('提交中...', 4);
            post("/?m=ureport&do=post_report&json=true",newdata,function(data){
                hideNewBox();
                if(!data) return;
                if(data.id != '0035') {
                    if(data.info) data.msg += data.info;
                    msg(data.msg, 4);
                    if(data.id == '0000') {
                        hideNewBox();
                        loginIn();
                        return;
                    }
                } else {
                    hideAllbox();
                    msg(data.msg,1);
                    setTimeout(function(){
                        my_app_page(currentPage);
                    },200);
                    return;
                }
            });

        });
    }


    //检测上传订单图
    function checkUploadPic(form) {
        var posturl = form.find('.chose_url').val();
        if(!posturl) {
            msg('请先选择电脑里的图片');
            return false;
        }
        var geshi = posturl.substring(posturl.length-4).toLowerCase();
        if(geshi !=='.jpg' && geshi !=='jpeg' && geshi !=='.png') {
            msg('抱歉,图片只支持jgp或png格式',4);
            return false;
        }
        msg('图片上传中，请不要关闭网页');
    }
    //上传图片
    $('#upload_action_pic').load(function(){ //off('load')
        var frameText = $(this).contents().find("body").html();
        if(frameText) {
            hideNewBox();
            eval('var data = '+frameText);
            if(data.id != '0106') {
                if(data.id == '0000') {
                    loginIn();
                    return;
                }
                messageWait('提示您', data.msg+'：'+data.info);
            } else {
                messageHide('图片上传成功');
                if(data.info) {
                    var form = $('#write_report_form');
                    form.find("#report_imgurl").val(data.info);
                    form.find('#view_report_img').show().attr('src', data.info+'?_=' + Math.random());
                }
            }
        }
    });

    $(function(){
        starsAddEvent(); //星星样式初始化
        var form = $('#write_report_form');
        var startForm = form.find('.start_table');
        var modify_type = form.find('#modify_type').val();
        if(modify_type == 'edit') {
            addStyle(startForm,"zuogong", r_waiguan);
            addStyle(startForm,"gneng", r_gongneng);
            addStyle(startForm,"shiyong", r_shiyong);
        } else {
            addStyle(form,"zuogong", 5);
            addStyle(form,"gneng", 5);
            addStyle(form,"shiyong", 5);
        }

    });



</script>
</body>
</html>